package com.mission.schedule.my160920;

import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.Activity;
import android.app.Dialog;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.util.Log;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ScrollView;
import android.widget.TextView;
import android.widget.Toast;

import com.android.volley.AuthFailureError;
import com.android.volley.DefaultRetryPolicy;
import com.android.volley.Request;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.aspsine.swipetoloadlayout.OnRefreshListener;
import com.aspsine.swipetoloadlayout.SwipeToLoadLayout;
import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
import com.mission.schedule.R;
import com.mission.schedule.activity.BaseActivity;
import com.mission.schedule.add603.bean.UserNewLy;
import com.mission.schedule.applcation.App;
import com.mission.schedule.bean.MyMessageBackBean;
import com.mission.schedule.bean.MyMessageBean;
import com.mission.schedule.bean.MySchBean;
import com.mission.schedule.constants.ShareFile;
import com.mission.schedule.constants.URLConstants;
import com.mission.schedule.db.DBHelper;
import com.mission.schedule.entity.ScheduleTable;
import com.mission.schedule.my160920.adapter.FrendLyAdapter;
import com.mission.schedule.my160920.bean.FriendDownAllScheduleBean;
import com.mission.schedule.my160920.widget.OnRefreshRecyclerViewHeader;
import com.mission.schedule.utils.CharacterUtil;
import com.mission.schedule.utils.DateUtil;
import com.mission.schedule.utils.ProgressUtil;
import com.mission.schedule.utils.SharedPrefUtil;
import com.nostra13.universalimageloader.core.ImageLoader;

import org.json.JSONException;
import org.json.JSONObject;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by liwei on 16/9/20.
 */
public class FrendLyActivity extends BaseActivity {

    private TextView ly_title, ly_mess, ly_name, ly_time, ly_num, bj_ll, ly_model;
    private Intent intent;
    private RoundImageView ly_icon;
    private FrendLyAdapter frendLyAdapter;
    private RecyclerView recyclerView;
    private List<ListLyBean> lyBeanList;
//    private SwipeRefreshLayout swipeRefreshLayout;
    private LinearLayout top_ll_left;
    private EditText friend_ly_et_send_message;
    private Button friend_ly_btn_send_message, friend_ly_btn_common;
    List<CalendarBean> calendarBeanList;

    public String message;
    public String calendarID = "", cids = "";

    SharedPrefUtil sharedPrefUtil = null;
    ScrollView swipe_target;

    int types = 0;

    String userID = "0";

    MySchBean mySchBean = null;
    UserNewLy.ListBean listBean = null;
    String content = "";
    String uName = "";

    private boolean bjType = false;//是否编辑
    private boolean endType = false;//是否结束过来
    private boolean isContentType = false;

    SwipeToLoadLayout toLoadLayout;

    @Override
    protected void setListener() {

    }

    @Override
    protected void setContentView() {
        setContentView(R.layout.new_my_frendly);
        intent = getIntent();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        App.getHttpQueues().cancelAll("downfrednly");
        App.getHttpQueues().cancelAll("modificationMessageTime");
    }

    String id = "";

    //http://121.40.19.103/timetable/appFrends_downFrendsCalendar.do?uId=52432&updateTime=2015-01-01 00:00:00
    @TargetApi(Build.VERSION_CODES.M)
    @Override
    protected void init(Bundle savedInstanceState) {

        mySchBean = new MySchBean();

        sharedPrefUtil = new SharedPrefUtil(this, ShareFile.USERFILE);

        /** 检查是否有发出的好友表和日程表,没有则创建*/
        DBHelper helper = new DBHelper(this);
        if (!helper.tabIsExist("FriendCommonReply")) {
            App.getDBcApplication().createTbaleFriendCommonReply();
        }

        if (App.getDBcApplication().queryFriendCommonReply().size() <= 0) {
            App.getDBcApplication().insertFriendCommonReply("已收到");
        }

        calendarBeanList = new ArrayList<>();

        userID = sharedPrefUtil.getString(this, ShareFile.USERFILE,
                ShareFile.USERID, "0");
        uName = sharedPrefUtil.getString(this,
                ShareFile.USERFILE, ShareFile.USERNAME, "");

        ly_title = (TextView) findViewById(R.id.ly_title);
        ly_mess = (TextView) findViewById(R.id.ly_message);
        swipe_target = (ScrollView) findViewById(R.id.swipe_target);
        ly_mess.setOnLongClickListener(new View.OnLongClickListener() {
            @Override
            public boolean onLongClick(View v) {

//                ClipboardManager cm = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
//                // 将文本内容放到系统剪贴板里。
//                cm.setText(ly_mess.getText().toString());
//                Toast.makeText(FrendLyActivity.this, "已复制", Toast.LENGTH_SHORT).show();
                alterImportantDialog(FrendLyActivity.this,ly_mess.getText().toString());
                return false;
            }
        });
        ly_name = (TextView) findViewById(R.id.ly_name);
        ly_time = (TextView) findViewById(R.id.ly_time);
        ly_num = (TextView) findViewById(R.id.ly_num);
        ly_model = (TextView) findViewById(R.id.ly_model);
        ly_icon = (RoundImageView) findViewById(R.id.ly_icon);
        friend_ly_et_send_message = (EditText) findViewById(R.id.friend_ly_et_send_message);

        top_ll_left = (LinearLayout) findViewById(R.id.ly_top_ll_left);
        bj_ll = (TextView) findViewById(R.id.bj_ll);
        friend_ly_btn_send_message = (Button) findViewById(R.id.friend_ly_btn_send_message);
        friend_ly_btn_common = (Button) findViewById(R.id.friend_ly_btn_common);
        top_ll_left.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onBackPressed();
            }
        });


        toLoadLayout = (SwipeToLoadLayout)findViewById(R.id.lys_swip);
        OnRefreshRecyclerViewHeader header = (OnRefreshRecyclerViewHeader)findViewById(R.id.swipe_refresh_header);
        toLoadLayout.setRefreshHeaderView(header);
        toLoadLayout.setOnRefreshListener(new OnRefreshListener() {
            @Override
            public void onRefresh() {
                FrendLy();
            }
        });


        if (intent.getIntExtra("types", 0) == 0) {
            types = 0;
            bj_ll.setText("编辑");

            final FrendBean frendBean = (FrendBean) intent.getSerializableExtra("schedule");
            calendarID = frendBean.calendaId;
            content = frendBean.message;
            //修改时间
            modificationMessageTime();
            bj_ll.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
//                String i = mMap.get(ScheduleTable.schID);
                    Intent intentSchedule = new Intent();
                    Bundle bundle = new Bundle();

                    bundle.putSerializable("schedule", frendBean);
                    intentSchedule.putExtras(bundle);
                    startActivityForResult(intent.setClass(FrendLyActivity.this, FriendScheduleCompileActivity.class), 900);
                }
            });
            id = frendBean.id;

            /**
             *
             */
            update();
            calendarID = frendBean.getId();
            ly_name.setText(sharedPrefUtil.getString(this,
                    ShareFile.USERFILE, ShareFile.USERNAME, ""));
            ly_time.setText(frendBean.cretetime.replace("T", " ").substring(5, frendBean.cretetime.length() - 3));
            ly_model.setText(frendBean.remark1);

            //        ly_mess.setText(intent.getStringExtra("message"));
            //        ly_name.setText(intent.getStringExtra("name"));
            //        ly_time.setText(intent.getStringExtra("change_time").replace("T", " "));
            //  ImageLoader.getInstance().displayImage(imageUrl(intent.getStringExtra("uPortrait")), ly_icon, base_options);

            /****
             *  if (keyCode == KeyEvent.KEYCODE_ENTER) {
             ((InputMethodManager) getSystemService(INPUT_METHOD_SERVICE))
             .hideSoftInputFromWindow(LoginActivity.this.getCurrentFocus()
             .getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
             if(TextUtil.isEmpty(mPassWord.getText().toString())){
             ToastUtil.getInstance().show("请输入密码");
             }else{
             login(mUserName.getText().toString(),mPassWord.getText().toString());
             }
             }
             */
            String image_head = sharedPrefUtil.getString(this, ShareFile.USERFILE, ShareFile.USERPHOTOPATH, "");
            String imageUrl = URLConstants.图片 + image_head + "&imageType=2&imageSizeType=3";

            ImageLoader.getInstance().displayImage(imageUrl, ly_icon, base_options);

        } else if (intent.getIntExtra("types", 0) == 3) {
            types = 0;
            endType = true;
            bj_ll.setText("编辑");

            final FrendBean frendBean = (FrendBean) intent.getSerializableExtra("schedule");
            calendarID = frendBean.calendaId;
            content = frendBean.message;
            //修改时间
            modificationMessageTime();
            bj_ll.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
//                String i = calendarBeanList.get(0).schID);
                    Intent intentSchedule = new Intent();
                    Bundle bundle = new Bundle();

                    bundle.putSerializable("schedule", frendBean);
                    intentSchedule.putExtras(bundle);
                    startActivityForResult(intent.setClass(FrendLyActivity.this, FriendScheduleCompileActivity.class), 900);
                }
            });
            id = frendBean.id;

            /**
             *
             */
            update();
            calendarID = frendBean.getId();
            ly_name.setText(sharedPrefUtil.getString(this,
                    ShareFile.USERFILE, ShareFile.USERNAME, ""));
            ly_time.setText(frendBean.cretetime.replace("T", " ").substring(5, frendBean.cretetime.length() - 3));
            ly_model.setText(frendBean.remark1);

            //        ly_mess.setText(intent.getStringExtra("message"));
            //        ly_name.setText(intent.getStringExtra("name"));
            //        ly_time.setText(intent.getStringExtra("change_time").replace("T", " "));
            //  ImageLoader.getInstance().displayImage(imageUrl(intent.getStringExtra("uPortrait")), ly_icon, base_options);

            /****
             *  if (keyCode == KeyEvent.KEYCODE_ENTER) {
             ((InputMethodManager) getSystemService(INPUT_METHOD_SERVICE))
             .hideSoftInputFromWindow(LoginActivity.this.getCurrentFocus()
             .getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
             if(TextUtil.isEmpty(mPassWord.getText().toString())){
             ToastUtil.getInstance().show("请输入密码");
             }else{
             login(mUserName.getText().toString(),mPassWord.getText().toString());
             }
             }
             */
            String image_head = sharedPrefUtil.getString(this, ShareFile.USERFILE, ShareFile.USERPHOTOPATH, "");
            String imageUrl = URLConstants.图片 + image_head + "&imageType=2&imageSizeType=3";

            ImageLoader.getInstance().displayImage(imageUrl, ly_icon, base_options);

        } else if (intent.getIntExtra("types", 0) == 1) {
            types = 1;
            bj_ll.setText("转发");
//            bj_ll.setVisibility(View.GONE);
            modificationMessageTime();
            mySchBean = (MySchBean) getIntent().getSerializableExtra("bean");

//            intent.getStringExtra("schContent");
//            intent.getStringExtra("schDate");
//            intent.getStringExtra("schTime");
//            intent.getStringExtra("schIsPostpone");
//            intent.getStringExtra("schDisplayTime");
//            intent.getStringExtra("schCreateTime");
//            intent.getStringExtra("schcRecommendName");
//            intent.getStringExtra("schImagePath");

            calendarID = mySchBean.schID;
            content = mySchBean.schContent;

            String isBacklog = "";
            if (mySchBean.schIsPostpone.equals("1") && mySchBean.schDisplayTime.equals("0")) {
                isBacklog = "待办";
                ly_title.setText(mySchBean.schDate.substring(5, mySchBean.schDate.length()) + " " + isBacklog + " " +
                        CharacterUtil.getWeekOfDate(this, DateUtil.parseDate(mySchBean.schDate)) + "  " + getData(mySchBean.schDate));
            } else {
                ly_title.setText(mySchBean.schDate.substring(5, mySchBean.schDate.length()) + " " +
                        CharacterUtil.getWeekOfDate(this, DateUtil.parseDate(mySchBean.schDate)) + "  " + getData(mySchBean.schDate));
            }

            ly_mess.setText(mySchBean.schContent);
            ly_name.setText(mySchBean.schcRecommendName);
            ly_time.setText(mySchBean.schCreateTime.replace("T", " ").substring(5, mySchBean.schCreateTime.length() - 3));

            bj_ll.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Intent intent = new Intent();
                    intent.putExtra("bean", mySchBean);
                    startActivity(intent.setClass(FrendLyActivity.this, NewSchZhuanFaActivity.class));
                }
            });

            UpdateMyMessage(intent.getStringExtra("schFriendID"));
        } else if (intent.getIntExtra("types", 0) == 4) {
            types = 1;
            bj_ll.setText("转发");
//            bj_ll.setVisibility(View.GONE);
            modificationMessageTime();
            /**
             * intent1.putExtra("calendarID", nMap.get(position).get("calendarId"));
             intent1.putExtra("U_PORTRAIT", nMap.get(position).get("U_PORTRAIT"));
             intent1.putExtra("remark", nMap.get(position).get("remark"));
             intent1.putExtra("schFriendID", nMap.get(position).get("uid"));U_NICK_NAME
             */
            calendarID = intent.getStringExtra("calendarID");
            content = intent.getStringExtra("remark");

            ly_mess.setText(content);
            ly_name.setText(intent.getStringExtra("U_NICK_NAME"));

            bj_ll.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Intent intent = new Intent();
                    intent.putExtra("bean", mySchBean);
                    startActivity(intent.setClass(FrendLyActivity.this, NewSchZhuanFaActivity.class));
                }
            });
            UpdateMyMessage(intent.getStringExtra("schFriendID"));
        }

        friend_ly_et_send_message.setOnKeyListener(new View.OnKeyListener() {
            @Override
            public boolean onKey(View v, int keyCode, KeyEvent event) {
                if (keyCode == KeyEvent.KEYCODE_ENTER && event.getAction() == KeyEvent.ACTION_DOWN) {
                    ((InputMethodManager) getSystemService(INPUT_METHOD_SERVICE))
                            .hideSoftInputFromWindow(FrendLyActivity.this.getCurrentFocus()
                                    .getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
                    String msg = friend_ly_et_send_message.getText().toString();
                    if (TextUtils.isEmpty(msg) || "".equals(msg)) {
                        showToast("留言信息不能为空！");
                    } else {
                        message = friend_ly_et_send_message.getText().toString();
                        //发送留言
                        downFrendLy(message);
                        friend_ly_et_send_message.setText("");
                    }
                }
                return false;
            }
        });

        friend_ly_btn_send_message.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                String msg = friend_ly_et_send_message.getText().toString();
                if (TextUtils.isEmpty(msg) || "".equals(msg)) {
                    showToast("留言信息不能为空！");
                } else {
                    message = friend_ly_et_send_message.getText().toString();
                    //发送留言
                    downFrendLy(message);
                    friend_ly_et_send_message.setText("");
                }
            }
        });

        friend_ly_btn_common.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(FrendLyActivity.this, CommonReplyActivity.class);
                startActivityForResult(intent, 100);
            }
        });

//        swipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.lys_swip);
//        swipeRefreshLayout.setColorSchemeResources(R.color.xinjianricheng_bg);
//        swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
//            @Override
//            public void onRefresh() {
//                FrendLy();
//            }
//        });

        recyclerView = (RecyclerView) findViewById(R.id.lys_recy);
        recyclerView.setNestedScrollingEnabled(false);
        recyclerView.setHasFixedSize(true);

        lyBeanList = new ArrayList<>();

//        frendLyBeanList = App.getDBcApplication().getFrendLy(intent.getStringExtra("cid"));

        ly_num.setText("留言(" + lyBeanList.size() + ")");

        frendLyAdapter = new FrendLyAdapter(this, lyBeanList);
        recyclerView.setLayoutManager(new ScrollLinearLayoutManager(this));
        recyclerView.setItemAnimator(new DefaultItemAnimator());
        recyclerView.setAdapter(frendLyAdapter);


//        swipe_target.setOnScrollChangeListener(new View.OnScrollChangeListener() {
//            @Override
//            public void onScrollChange(View v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
//                if(scrollY == 0){
//                    // 到顶部了
//                    //TODO
//                    toLoadLayout.setRefreshEnabled(true);
//                }
//            }
//        });
//        recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
//            @Override
//            public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
//                super.onScrolled(recyclerView, dx, dy);
//                int topRowVerticalPosition =
//                        (recyclerView == null || recyclerView.getChildCount() == 0) ? 0 : recyclerView.getChildAt(0).getTop();
//                toLoadLayout.setRefreshEnabled(topRowVerticalPosition >= 0);
//            }
//
//            @Override
//            public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
//                super.onScrollStateChanged(recyclerView, newState);
//            }
//        });

        FrendLy();
    }


    /**
     * 点击留言
     */
    private void alterImportantDialog(Context context,String message) {
        Dialog dialog = new Dialog(context, R.style.dialog_translucent_adjustPan);
        Window window = dialog.getWindow();
        android.view.WindowManager.LayoutParams params = window.getAttributes();// 获取LayoutParams
        params.alpha = 0.92f;
        window.setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL);
        window.setAttributes(params);// 设置生效

        LayoutInflater fac = LayoutInflater.from(context);
        View more_pop_menu = fac.inflate(R.layout.add_reply_dialogs, null);
        dialog.setCanceledOnTouchOutside(true);
        dialog.setContentView(more_pop_menu);
        params.height = ViewGroup.LayoutParams.WRAP_CONTENT;
        params.width = ViewGroup.LayoutParams.MATCH_PARENT;
        dialog.show();

        new alterImportantDialogOnClick(context,dialog, more_pop_menu,message);
    }

    class alterImportantDialogOnClick implements View.OnClickListener {

        private View view;
        private Dialog dialog;
        private TextView add_tv;
        private TextView copy_tv;
        private TextView canel_tv;
        private String message;
        private Context context;

        @SuppressLint("NewApi")
        public alterImportantDialogOnClick(Context context,Dialog dialog, View view,String message) {
            this.dialog = dialog;
            this.view = view;
            this.message = message;
            this.context = context;
            initview();
        }

        private void initview() {
            copy_tv = (TextView) view.findViewById(R.id.copy_tv);
            copy_tv.setOnClickListener(this);
            canel_tv = (TextView) view.findViewById(R.id.canel_tv);
            canel_tv.setOnClickListener(this);
        }

        @Override
        public void onClick(View v) {
            switch (v.getId()) {
                case R.id.copy_tv:
                    // 为了兼容低版本我们这里使用旧版的android.text.ClipboardManager，虽然提示deprecated，但不影响使用。
                    ClipboardManager cm = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);
                    // 将文本内容放到系统剪贴板里。
                    cm.setText(message);
                    Toast.makeText(context, "已复制", Toast.LENGTH_SHORT).show();
                    dialog.dismiss();
                    break;
                case R.id.canel_tv:
                    dialog.dismiss();
                    break;
            }
        }
    }


    private void update() {
        ArrayList<FriendDownAllScheduleBean> friendDownAllScheduleBeanArrayList = App.getDBcApplication().queryFriendSchedule(id);


        String isBacklog = "";
        if (friendDownAllScheduleBeanArrayList.get(0).CPostpone.equals("1") && friendDownAllScheduleBeanArrayList.get(0).repDisplayTime.equals("0")) {
            isBacklog = "待办";
            ly_title.setText(friendDownAllScheduleBeanArrayList.get(0).getCdate().substring(5, friendDownAllScheduleBeanArrayList.get(0).getCdate().length()) + " " + isBacklog + " " +
                    CharacterUtil.getWeekOfDate(this, DateUtil.parseDate(friendDownAllScheduleBeanArrayList.get(0).getCdate())) + "  " + getData(friendDownAllScheduleBeanArrayList.get(0).getCdate()));
        } else {
            ly_title.setText(friendDownAllScheduleBeanArrayList.get(0).getCdate().substring(5, friendDownAllScheduleBeanArrayList.get(0).getCdate().length()) + " " +
                    CharacterUtil.getWeekOfDate(this, DateUtil.parseDate(friendDownAllScheduleBeanArrayList.get(0).getCdate())) + "  " + getData(friendDownAllScheduleBeanArrayList.get(0).getCdate()));
        }

        ly_mess.setText(friendDownAllScheduleBeanArrayList.get(0).message);
        content = friendDownAllScheduleBeanArrayList.get(0).message;
    }


    /***
     * 返回天数
     *
     * @param time
     * @return
     */
    public String getData(String time) {

        Date dateStr = DateUtil.parseDate(time);
        Date dateToday1 = DateUtil.parseDate(DateUtil
                .formatDate(new Date()));
        String ymdState = "";
        int count = (int) ((dateToday1.getTime() - dateStr.getTime()) / (1000 * 60 * 60 * 24));
        if (count > 0) {
            if (count == 1) {
                ymdState = "昨天  ";
            } else {
                ymdState = count + "天前  ";
            }
        } else if (count == 0) {
            ymdState = "今天  ";
        } else {
            if (Math.abs(count) == 1) {
                ymdState = "明天  ";
            } else {
                ymdState = Math.abs(count) + "天后  ";
            }
        }
//        ymdState += CharacterUtil.getWeekOfDate(this,
//                DateUtil.parseDate(time));

        return ymdState;
    }

    @Override
    protected void setAdapter() {

    }

    public void showToast(String msg) {
        Toast.makeText(FrendLyActivity.this, msg, Toast.LENGTH_SHORT).show();
    }

    final ProgressUtil progressUtil = new ProgressUtil();

    public void modificationMessageTime() {

        StringRequest stringRequest = new StringRequest(Request.Method.POST, URLConstants.HOST+"/appFrends_updateTbUserLyTime.do", new Response.Listener<String>() {
            @Override
            public void onResponse(String s) {
                try {
                    if (responseCode(s)) {
                        //TODO  修改时间成功
                    }
                } catch (JSONException e) {
                    e.printStackTrace();
                }
            }
        }, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError volleyError) {
                Log.d("TAG", "error:" + volleyError.toString());
            }
        }) {

            @Override
            protected Map<String, String> getParams() throws AuthFailureError {
                Map<String, String> map = new HashMap<>();
                map.put("uId", userID);
                map.put("cId", calendarID);
                map.put("type", types + "");
                return map;
            }

        };
        stringRequest.setTag("modificationMessageTime");
        stringRequest.setRetryPolicy(new DefaultRetryPolicy(100000, 1, 1.0f));
        App.queues.add(stringRequest);
    }

    public void downFrendLy(final String msg) {
        progressUtil.ShowProgress(FrendLyActivity.this, true, true, "正在发送留言...");
        StringRequest stringRequest = new StringRequest(Request.Method.POST,URLConstants.HOST+"/appFrends_" + (types == 1 ? "addAppLy" : "addWebFrendsLyMess") + ".do",
                new Response.Listener<String>() {
                    @Override
                    public void onResponse(String result) {
                        if (!TextUtils.isEmpty(result)) {
                            progressUtil.dismiss();
                            try {
                                if (responseCode(result)){
                                    FrendLy();
                                }
                            } catch (Exception e) {
                                e.printStackTrace();
                            }
                        }
                    }

                }, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError volleyError) {
                Log.d("TAG", "error:" + volleyError.toString());
                progressUtil.dismiss();
            }
        }) {
            @Override
            protected Map<String, String> getParams() throws AuthFailureError {
                Map<String, String> map = new HashMap<>();
                if (types == 0) {
                    map.put("ly.uid", userID);
                    map.put("ly.cid", calendarID);
                    map.put("ly.mess", msg);
                    map.put("content", content);
                    map.put("ly.remark", content);
                    map.put("ly.remark1 ", uName);
                } else {
                    map.put("uName", uName);
                    map.put("uId", userID);
                    map.put("cId", calendarID);
                    map.put("val", msg);
                    map.put("content", content);
                }

                return map;
            }
        };
        stringRequest.setTag("downfrednly");
        stringRequest.setRetryPolicy(new DefaultRetryPolicy(100000, 1, 1.0f));
        App.queues.add(stringRequest);
    }

    public void FrendLy() {
        progressUtil.ShowProgress(this,true,true,"正在同步数据...");
        StringRequest stringRequest = new StringRequest(Request.Method.POST,URLConstants.HOST+"/appFrends_findWebLy.do",
                new Response.Listener<String>() {
                    @Override
                    public void onResponse(String result) {

                        if (!TextUtils.isEmpty(result)) {
                            toLoadLayout.setRefreshing(false);
                            try {
                                // Gson gson = new Gson();
                                if (responseCode(result)) {

                                    Gson gson = new Gson();
                                    Log.e("TAG", result);
                                    LYBean findC = gson.fromJson(result, LYBean.class);
                                    if (findC.status == 0) {
                                        List<ListLyBean> lyBeanList = findC.list.get(0).ly;
                                        List<CalendarBean> calendarList = findC.list.get(0).calendar;
                                        for (int i = 1; i < lyBeanList.size(); i++) {
                                            for (int j = 0; j < lyBeanList.size() - i; j++) {
                                                DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

                                                Date d1 = df.parse(lyBeanList.get(j + 1).getChangeTime().replace('T', ' '));
                                                Date d2 = df.parse(lyBeanList.get(j).getChangeTime().replace('T', ' '));
                                                long diff = d1.getTime() - d2.getTime();
                                                if (diff > 0) {
                                                    ListLyBean temp = lyBeanList.get(j);
                                                    lyBeanList.set(j, lyBeanList.get(j + 1));
                                                    lyBeanList.set(j + 1, temp);
                                                }

                                            }
                                        }
                                        calendarBeanList.addAll(calendarList);
                                        if (calendarBeanList.size() > 0 && ( getIntent().getIntExtra("types",0) == 1 ||
                                                getIntent().getIntExtra("types",0) == 4)) {
                                            App.getDBcApplication().updateScheduleData2(
                                                    Integer.valueOf(calendarID),
                                                    calendarBeanList.get(0).message,
                                                    calendarBeanList.get(0).CAlarmsound,
                                                    calendarBeanList.get(0).CAlarmsoundDesc,
                                                    calendarBeanList.get(0).CPostpone,
                                                    calendarBeanList.get(0).atype,
                                                    String.valueOf(calendarBeanList.get(0).cbeforTime),
                                                    String.valueOf(calendarBeanList.get(0).cisAlarm),
                                                    calendarBeanList.get(0).ctime,
                                                    String.valueOf(calendarBeanList.get(0).repDisplayTime),
                                                    calendarBeanList.get(0).webUrl,
                                                    calendarBeanList.get(0).cretetime,
                                                    calendarBeanList.get(0).cdate
                                            );
                                            send(2);
                                        }


                                        frendLyAdapter = new FrendLyAdapter(FrendLyActivity.this, lyBeanList);
                                        recyclerView.setLayoutManager(new LinearLayoutManager(FrendLyActivity.this));
                                        recyclerView.setItemAnimator(new DefaultItemAnimator());
                                        recyclerView.setAdapter(frendLyAdapter);
                                        ly_num.setText("留言(" + lyBeanList.size() + ")");
                                        modificationMessageTime();
                                    }
                                    progressUtil.dismiss();
                                }
                            } catch (Exception e) {
                                progressUtil.dismiss();
                                e.printStackTrace();
                            }
                        }
                    }

                }, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError volleyError) {
                progressUtil.dismiss();
                Log.d("TAG", "error:" + volleyError.toString());
            }
        }) {
            @Override
            protected Map<String, String> getParams() throws AuthFailureError {
                Map<String, String> map = new HashMap<>();
                map.put("calendarID", calendarID);
                map.put("type", types + "");
                return map;
            }
        };
        stringRequest.setTag("appFrends_findWebLy");
        stringRequest.setRetryPolicy(new DefaultRetryPolicy(100000, 1, 1.0f));
        App.queues.add(stringRequest);
    }


    public boolean responseCode(String response) throws JSONException {
        int status = 0;
        JSONObject jsonObject = new JSONObject(response);
        int msg = jsonObject.getInt("status");
        return status == msg;
    }

    /**
     * 按home键进行个人信息同步
     *
     * @author lenovo
     */
    private void UpdateMyMessage(String userId) {
        // new MyMessageAsync().execute(URLConstants.查询个人信息 + "?uid=" + userId);
        String path = URLConstants.查询个人信息 + "?uid=" + userId;
        StringRequest request = new StringRequest(Request.Method.GET, path,
                new Response.Listener<String>() {
                    @Override
                    public void onResponse(String s) {
                        Log.e("TAG", s);
                        Gson gson = new Gson();
                        try {
                            MyMessageBackBean backBean = gson.fromJson(s,
                                    MyMessageBackBean.class);
                            if (backBean.status == 0) {
                                MyMessageBean bean = null;
                                if (backBean.list != null
                                        && backBean.list.size() > 0) {
                                    for (int i = 0; i < backBean.list
                                            .size(); i++) {
                                        bean = backBean.list.get(i);
                                    }
                                    String imageUrl = URLConstants.图片 + bean.uPortrait + "&imageType=2&imageSizeType=3";

                                    ImageLoader.getInstance().displayImage(imageUrl, ly_icon, base_options);

                                } else {
                                    return;
                                }
                            }
                        } catch (JsonSyntaxException e) {
                            e.printStackTrace();
                        }
                    }
                }, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError volleyError) {
            }
        });
        request.setTag("down");
        request.setRetryPolicy(new DefaultRetryPolicy(20000, 1, 1.0f));
        App.getHttpQueues().add(request);
    }

    /** */
    /**
     * 获取现在时间
     *
     * @return返回字符串格式 yyyy-MM-dd HH:mm:ss
     */
    public static String getStringDate() {
        long send_message_time = System.currentTimeMillis();
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String dateString = formatter.format(send_message_time);
        return dateString;
    }

    @Override
    public void onBackPressed() {
        super.onBackPressed();
        InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
        imm.hideSoftInputFromWindow(getWindow().peekDecorView().getWindowToken(), 0); //强制隐藏键盘
        if (types == 0) {
            if (bjType == true) {
                Intent intent = new Intent();
                intent.setAction("ly");
                intent.putExtra("l", 1);
                sendBroadcast(intent);
            }
            if (endType == true) {
                Intent intent = new Intent();
                intent.setAction("end");
                intent.putExtra("l", 1);
                sendBroadcast(intent);
            }
            finish();
        } else if (types == 1) {
            Intent intent = new Intent();
            if (getIntent().getIntExtra("types",0) == 4){
                intent.setAction("newinfor");
                intent.putExtra("l", 1);
            }else {
                intent.setAction("ntype");
                intent.putExtra("l", 1);
            }
            sendBroadcast(intent);
            finish();
        }
    }

    private void send(int what) {
        Message message = new Message();
        message.what = what;
        handler.sendMessage(message);
    }

    Handler handler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            super.handleMessage(msg);
            switch (msg.what) {
                case 1:
                    //发送留言
                    downFrendLy(mess);
                    friend_ly_et_send_message.setText("");
                    break;
                case 2:
                    String isBacklog = "待办";
                    if (calendarBeanList.get(0).poststate.equals("1") && calendarBeanList.get(0).repDisplayTime == 0) {
                        isBacklog = "待办";
                        ly_title.setText(calendarBeanList.get(0).cdate.substring(5, calendarBeanList.get(0).cdate.length()) + " " + isBacklog + " " +
                                CharacterUtil.getWeekOfDate(FrendLyActivity.this, DateUtil.parseDate(calendarBeanList.get(0).cdate))
                                + "  " + getData(calendarBeanList.get(0).cdate));
                    } else {
                        ly_title.setText(calendarBeanList.get(0).cdate.substring(5, calendarBeanList.get(0).cdate.length()) + " " +
                                CharacterUtil.getWeekOfDate(FrendLyActivity.this, DateUtil.parseDate(calendarBeanList.get(0).cdate)) + "  " + getData(calendarBeanList.get(0).cdate));
                    }
                    content = calendarBeanList.get(0).message;
                    ly_mess.setText(calendarBeanList.get(0).message);
                    ly_time.setText(calendarBeanList.get(0).cretetime.replace("T", " ").substring(5, calendarBeanList.get(0).cretetime.length() - 3));
                    ly_model.setText(calendarBeanList.get(0).remark1);

                    mySchBean.schContent = calendarBeanList.get(0).message;
                    mySchBean.schDisplayTime = calendarBeanList.get(0).repDisplayTime+"";
                    mySchBean.schIsPostpone = calendarBeanList.get(0).CPostpone+"";
                    mySchBean.schSourceDesc = calendarBeanList.get(0).CTypeDesc+"";
                    mySchBean.schSourceDescSpare = calendarBeanList.get(0).CTypeSpare;
                    mySchBean.schRingDesc = calendarBeanList.get(0).CAlarmsoundDesc+"";
                    mySchBean.schRingCode = calendarBeanList.get(0).CAlarmsound+"";
                    mySchBean.imgPath = calendarBeanList.get(0).imgPath;
                    mySchBean.webUrl = calendarBeanList.get(0).webUrl;
                    break;
            }
        }
    };

    String mess = "";

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode == 900) {
            if (resultCode == Activity.RESULT_OK) {
                bjType = true;
                update();
            }
        }
        if (requestCode == 100) {
            if (resultCode == Activity.RESULT_OK) {
                if (data.getStringExtra("mess") != null) {
                    mess = data.getStringExtra("mess");
                    Message message = new Message();
                    message.what = 1;
                    handler.sendMessage(message);
                }
            }
        }
    }


    public class LYBean {

        /**
         * list : [{"uid":"255212","U_BACKGROUND_IMAGE":"20160101/773072.jpg","remark":null,"U_NICK_NAME":"周小","changeTime":"2016-08-01T14:45:12","mess":"你不早说不坐了","cId":"3","U_PORTRAIT":"20151110/56743.jpg","cType":0},{"uid":"1025621","U_BACKGROUND_IMAGE":null,"remark":null,"U_NICK_NAME":"大李a","changeTime":"2016-08-01T14:44:10","mess":"嘿嘿","cId":"3","U_PORTRAIT":"default/pic_14.jpg","cType":0}]
         * message : 成功
         * status : 0
         */

        private String message;
        private int status;
        public List<ListBean> list;

        /**
         * uid : 255212
         * U_BACKGROUND_IMAGE : 20160101/773072.jpg
         * remark : null
         * U_NICK_NAME : 周小
         * changeTime : 2016-08-01T14:45:12
         * mess : 你不早说不坐了
         * cId : 3
         * U_PORTRAIT : 20151110/56743.jpg
         * cType : 0
         */

        public String getMessage() {
            return message;
        }

        public void setMessage(String message) {
            this.message = message;
        }

        public int getStatus() {
            return status;
        }

        public void setStatus(int status) {
            this.status = status;
        }


    }


    public class ListBean {
        public List<ListLyBean> ly;
        public List<CalendarBean> calendar;

        @Override
        public String toString() {
            return "ListBean{" +
                    "ly=" + ly +
                    ", calendar=" + calendar +
                    '}';
        }
    }


    public class ListLyBean {
        public String uid;
        public String U_BACKGROUND_IMAGE;
        public String remark;
        public String U_NICK_NAME;
        public String changeTime;
        public String mess;
        public String cId;
        public String U_PORTRAIT;
        public int cType;

        public String getUid() {
            return uid;
        }

        public void setUid(String uid) {
            this.uid = uid;
        }

        public String getU_BACKGROUND_IMAGE() {
            return U_BACKGROUND_IMAGE;
        }

        public void setU_BACKGROUND_IMAGE(String U_BACKGROUND_IMAGE) {
            this.U_BACKGROUND_IMAGE = U_BACKGROUND_IMAGE;
        }

        public String getRemark() {
            return remark;
        }

        public void setRemark(String remark) {
            this.remark = remark;
        }

        public String getU_NICK_NAME() {
            return U_NICK_NAME;
        }

        public void setU_NICK_NAME(String U_NICK_NAME) {
            this.U_NICK_NAME = U_NICK_NAME;
        }

        public String getChangeTime() {
            return changeTime;
        }

        public void setChangeTime(String changeTime) {
            this.changeTime = changeTime;
        }

        public String getMess() {
            return mess;
        }

        public void setMess(String mess) {
            this.mess = mess;
        }

        public String getCId() {
            return cId;
        }

        public void setCId(String cId) {
            this.cId = cId;
        }

        public String getU_PORTRAIT() {
            return U_PORTRAIT;
        }

        public void setU_PORTRAIT(String U_PORTRAIT) {
            this.U_PORTRAIT = U_PORTRAIT;
        }

        public int getCType() {
            return cType;
        }

        public void setCType(int cType) {
            this.cType = cType;
        }

        @Override
        public String toString() {
            return "ListLyBean{" +
                    "uid='" + uid + '\'' +
                    ", U_BACKGROUND_IMAGE='" + U_BACKGROUND_IMAGE + '\'' +
                    ", remark='" + remark + '\'' +
                    ", U_NICK_NAME='" + U_NICK_NAME + '\'' +
                    ", changeTime='" + changeTime + '\'' +
                    ", mess='" + mess + '\'' +
                    ", cId='" + cId + '\'' +
                    ", U_PORTRAIT='" + U_PORTRAIT + '\'' +
                    ", cType=" + cType +
                    '}';
        }
    }


    public class CalendarBean {
        /**
         * CAlarmsound : g_88
         * CAlarmsoundDesc : 完成任务
         * CLightAppId : 0
         * COpenstate : 1
         * CPostpone : 1
         * CRecommendName : 15108409732
         * CTags :
         * CType : 0
         * CTypeDesc : null
         * CTypeSpare :
         * atype : 0
         * calendaId : 0
         * cbeforTime : 0
         * cdate : 2016-10-20
         * changTime : 2016-10-20T14:43:08
         * cisAlarm : 1
         * cpId : 255212
         * cretetime : 2016-10-20T14:35:00
         * ctime : 14:40
         * downNum : 1
         * downstate : 0
         * endNum : 1
         * endState : 0
         * id : 1653
         * imgPath :
         * lyNum : 4
         * message : 测试测试1
         * parReamrk :
         * pid :
         * poststate :
         * remark :
         * remark1 : MI 5
         * remark2 :
         * remark3 :
         * repCalendaState : 0
         * repCalendaTime : 0
         * repColorType : 0
         * repDisplayTime : 0
         * repInStable : 0
         * repIsPuase : 0
         * repState : 0
         * repType : 0
         * repTypeParameter :
         * repdatetwo : 0
         * repinitialcreatedtime :
         * replastcreatedtime :
         * repnextcreatedtime :
         * repstartdate :
         * repstatetwo : 0
         * schIsImportant : 0
         * status : 1
         * uid : 1140656
         * webUrl :
         */

        private String CAlarmsound;
        private String CAlarmsoundDesc;
        private String CLightAppId;
        private int COpenstate;
        private int CPostpone;
        private String CRecommendName;
        private String CTags;
        private int CType;
        private Object CTypeDesc;
        private String CTypeSpare;
        private int atype;
        private String calendaId;
        private int cbeforTime;
        private String cdate;
        private String changTime;
        private int cisAlarm;
        private String cpId;
        private String cretetime;
        private String ctime;
        private int downNum;
        private String downstate;
        private int endNum;
        private String endState;
        private int id;
        private String imgPath;
        private int lyNum;
        private String message;
        private String parReamrk;
        private String pid;
        private String poststate;
        private String remark;
        private String remark1;
        private String remark2;
        private String remark3;
        private String repCalendaState;
        private String repCalendaTime;
        private int repColorType;
        private int repDisplayTime;
        private int repInStable;
        private int repIsPuase;
        private String repState;
        private int repType;
        private String repTypeParameter;
        private String repdatetwo;
        private String repinitialcreatedtime;
        private String replastcreatedtime;
        private String repnextcreatedtime;
        private String repstartdate;
        private String repstatetwo;
        private String schIsImportant;
        private int status;
        private String uid;
        private String webUrl;

        public String getCAlarmsound() {
            return CAlarmsound;
        }

        public void setCAlarmsound(String CAlarmsound) {
            this.CAlarmsound = CAlarmsound;
        }

        public String getCAlarmsoundDesc() {
            return CAlarmsoundDesc;
        }

        public void setCAlarmsoundDesc(String CAlarmsoundDesc) {
            this.CAlarmsoundDesc = CAlarmsoundDesc;
        }

        public String getCLightAppId() {
            return CLightAppId;
        }

        public void setCLightAppId(String CLightAppId) {
            this.CLightAppId = CLightAppId;
        }

        public int getCOpenstate() {
            return COpenstate;
        }

        public void setCOpenstate(int COpenstate) {
            this.COpenstate = COpenstate;
        }

        public int getCPostpone() {
            return CPostpone;
        }

        public void setCPostpone(int CPostpone) {
            this.CPostpone = CPostpone;
        }

        public String getCRecommendName() {
            return CRecommendName;
        }

        public void setCRecommendName(String CRecommendName) {
            this.CRecommendName = CRecommendName;
        }

        public String getCTags() {
            return CTags;
        }

        public void setCTags(String CTags) {
            this.CTags = CTags;
        }

        public int getCType() {
            return CType;
        }

        public void setCType(int CType) {
            this.CType = CType;
        }

        public Object getCTypeDesc() {
            return CTypeDesc;
        }

        public void setCTypeDesc(Object CTypeDesc) {
            this.CTypeDesc = CTypeDesc;
        }

        public String getCTypeSpare() {
            return CTypeSpare;
        }

        public void setCTypeSpare(String CTypeSpare) {
            this.CTypeSpare = CTypeSpare;
        }

        public int getAtype() {
            return atype;
        }

        public void setAtype(int atype) {
            this.atype = atype;
        }

        public String getCalendaId() {
            return calendaId;
        }

        public void setCalendaId(String calendaId) {
            this.calendaId = calendaId;
        }

        public int getCbeforTime() {
            return cbeforTime;
        }

        public void setCbeforTime(int cbeforTime) {
            this.cbeforTime = cbeforTime;
        }

        public String getCdate() {
            return cdate;
        }

        public void setCdate(String cdate) {
            this.cdate = cdate;
        }

        public String getChangTime() {
            return changTime;
        }

        public void setChangTime(String changTime) {
            this.changTime = changTime;
        }

        public int getCisAlarm() {
            return cisAlarm;
        }

        public void setCisAlarm(int cisAlarm) {
            this.cisAlarm = cisAlarm;
        }

        public String getCpId() {
            return cpId;
        }

        public void setCpId(String cpId) {
            this.cpId = cpId;
        }

        public String getCretetime() {
            return cretetime;
        }

        public void setCretetime(String cretetime) {
            this.cretetime = cretetime;
        }

        public String getCtime() {
            return ctime;
        }

        public void setCtime(String ctime) {
            this.ctime = ctime;
        }

        public int getDownNum() {
            return downNum;
        }

        public void setDownNum(int downNum) {
            this.downNum = downNum;
        }

        public String getDownstate() {
            return downstate;
        }

        public void setDownstate(String downstate) {
            this.downstate = downstate;
        }

        public int getEndNum() {
            return endNum;
        }

        public void setEndNum(int endNum) {
            this.endNum = endNum;
        }

        public String getEndState() {
            return endState;
        }

        public void setEndState(String endState) {
            this.endState = endState;
        }

        public int getId() {
            return id;
        }

        public void setId(int id) {
            this.id = id;
        }

        public String getImgPath() {
            return imgPath;
        }

        public void setImgPath(String imgPath) {
            this.imgPath = imgPath;
        }

        public int getLyNum() {
            return lyNum;
        }

        public void setLyNum(int lyNum) {
            this.lyNum = lyNum;
        }

        public String getMessage() {
            return message;
        }

        public void setMessage(String message) {
            this.message = message;
        }

        public String getParReamrk() {
            return parReamrk;
        }

        public void setParReamrk(String parReamrk) {
            this.parReamrk = parReamrk;
        }

        public String getPid() {
            return pid;
        }

        public void setPid(String pid) {
            this.pid = pid;
        }

        public String getPoststate() {
            return poststate;
        }

        public void setPoststate(String poststate) {
            this.poststate = poststate;
        }

        public String getRemark() {
            return remark;
        }

        public void setRemark(String remark) {
            this.remark = remark;
        }

        public String getRemark1() {
            return remark1;
        }

        public void setRemark1(String remark1) {
            this.remark1 = remark1;
        }

        public String getRemark2() {
            return remark2;
        }

        public void setRemark2(String remark2) {
            this.remark2 = remark2;
        }

        public String getRemark3() {
            return remark3;
        }

        public void setRemark3(String remark3) {
            this.remark3 = remark3;
        }

        public String getRepCalendaState() {
            return repCalendaState;
        }

        public void setRepCalendaState(String repCalendaState) {
            this.repCalendaState = repCalendaState;
        }

        public String getRepCalendaTime() {
            return repCalendaTime;
        }

        public void setRepCalendaTime(String repCalendaTime) {
            this.repCalendaTime = repCalendaTime;
        }

        public int getRepColorType() {
            return repColorType;
        }

        public void setRepColorType(int repColorType) {
            this.repColorType = repColorType;
        }

        public int getRepDisplayTime() {
            return repDisplayTime;
        }

        public void setRepDisplayTime(int repDisplayTime) {
            this.repDisplayTime = repDisplayTime;
        }

        public int getRepInStable() {
            return repInStable;
        }

        public void setRepInStable(int repInStable) {
            this.repInStable = repInStable;
        }

        public int getRepIsPuase() {
            return repIsPuase;
        }

        public void setRepIsPuase(int repIsPuase) {
            this.repIsPuase = repIsPuase;
        }

        public String getRepState() {
            return repState;
        }

        public void setRepState(String repState) {
            this.repState = repState;
        }

        public int getRepType() {
            return repType;
        }

        public void setRepType(int repType) {
            this.repType = repType;
        }

        public String getRepTypeParameter() {
            return repTypeParameter;
        }

        public void setRepTypeParameter(String repTypeParameter) {
            this.repTypeParameter = repTypeParameter;
        }

        public String getRepdatetwo() {
            return repdatetwo;
        }

        public void setRepdatetwo(String repdatetwo) {
            this.repdatetwo = repdatetwo;
        }

        public String getRepinitialcreatedtime() {
            return repinitialcreatedtime;
        }

        public void setRepinitialcreatedtime(String repinitialcreatedtime) {
            this.repinitialcreatedtime = repinitialcreatedtime;
        }

        public String getReplastcreatedtime() {
            return replastcreatedtime;
        }

        public void setReplastcreatedtime(String replastcreatedtime) {
            this.replastcreatedtime = replastcreatedtime;
        }

        public String getRepnextcreatedtime() {
            return repnextcreatedtime;
        }

        public void setRepnextcreatedtime(String repnextcreatedtime) {
            this.repnextcreatedtime = repnextcreatedtime;
        }

        public String getRepstartdate() {
            return repstartdate;
        }

        public void setRepstartdate(String repstartdate) {
            this.repstartdate = repstartdate;
        }

        public String getRepstatetwo() {
            return repstatetwo;
        }

        public void setRepstatetwo(String repstatetwo) {
            this.repstatetwo = repstatetwo;
        }

        public String getSchIsImportant() {
            return schIsImportant;
        }

        public void setSchIsImportant(String schIsImportant) {
            this.schIsImportant = schIsImportant;
        }

        public int getStatus() {
            return status;
        }

        public void setStatus(int status) {
            this.status = status;
        }

        public String getUid() {
            return uid;
        }

        public void setUid(String uid) {
            this.uid = uid;
        }

        public String getWebUrl() {
            return webUrl;
        }

        public void setWebUrl(String webUrl) {
            this.webUrl = webUrl;
        }

    }
}
